<?php
/**
 * Created by PhpStorm.
 * User: xiaoxin
 * Date: 2018/10/29 0029
 * Time: 15:21
 */

namespace app\index\validate;
use think\Validate;

class CheckReg extends Validate
{
	protected $rule =   [
		'agreement'  => 'require',
		'captcha'=>'require|captcha',
		'password'=>'require|regex:[\w]{6,16}',
		'repassword'=>'require|confirm:password',
		'nickname'=>'require|regex:[\w]{6,10}|unique:user',
		'phone'=>'require|regex:^1[0-9]{10}$|unique:user',
	];

	protected $message  =   [
		'nickname.require' => '请填写名称',
		'phone.require' => '请填写手机',
		'password.require' => '请填写密码',
		'repassword.require' => '请填写确认密码',
		'repassword.confirm' => '两次密码不一致',
		'password.regex'     => '密码最多不能超过16个字符,最少6个',
		'nickname.regex'     => '名称最多不能超过15个字符,最少6个,只能是中文',
		'phone.regex'     => '手机格式错误',
		'phone.unique'     => '手机已被使用',
		'nickname.unique'     => '名称已被使用',
		'agreement'   => '请同意服务',
		'captcha.require'  => '请填写验证码',
		'captcha.captcha'  => '验证码错误',
	];

	protected $scene = [
		'captcha'  =>  ['captcha'],
		'pass'  =>  ['password','repassword'],
		'cp' =>['captcha','password','repassword'],
		'vercode'=>['phone','captcha'],
	];
}